package com.test;

import java.util.ArrayList;
import java.util.List;

import com.entity.Employee;
import com.ioc.DatabaseManagerFactory;

import ejp.Database;
import ejp.DatabaseManager;
import ejp.Result;

 
public class ResultServlet {  
 
	/**数据库管理对象*/
	private static final DatabaseManager dm = DatabaseManagerFactory.getDatabaseManager();
	
	public static void main(String[] args) throws Exception {
		long nowtime = System.currentTimeMillis();
		new ResultServlet().query();
		System.out.println((System.currentTimeMillis() - nowtime) + " ms");
	}
	
	public void query() throws Exception {
		Database db = dm.getDatabase();
		System.out.println("query begin..");		
		Result<Employee> re = db.queryObject(Employee.class, "where :username=?", "22222");
		for(Employee b : re) {
			System.out.println(b);
			System.out.println(b.getId());
			System.out.println(b.getUsername());
			System.out.println(b.getPwd());
		}
		System.out.println("query end..");
		re.close();
		db.close();
	}
 
	static{
		List list = new ArrayList();
		if(list != null && !list.isEmpty()){
			
		}
	}
}
